/**
 *
 */
package net.oschina.git.haxteam.zrank.message;

import com.sun.jndi.url.iiopname.iiopnameURLContextFactory;

/**
 * @author qq996
 *
 */
public class ProgressBarAPI {

	public static String showProgressBar(int length, String front, String back, int percent){
		StringBuilder Sb = new StringBuilder("");
		for(int i = 0 ; i < length ; i++){
			if(i >= percent){
				Sb.append(back);
			}else{
				Sb.append(front);
			}
		}
		return Sb.toString();
	}


	//测试拼接的差距
	/*public static void main(String[] args) {
		long time = System.currentTimeMillis();
		System.out.println(showProgressBar(50000,"a","b",6000));
		long now = System.currentTimeMillis();
		long end = now - time;
		System.out.println(end+"ms");


		time = System.currentTimeMillis();
		String s1 = "a";
		String s2 = "b";
		String s3 = s1+s1+s1+s1+s1+s1+s2+s2+s2+s2;
		for(int i = 0; i < 5000 ; i++){
			s3 += s1+s1+s1+s1+s1+s1+s2+s2+s2+s2;
		}
		System.out.println(s3);
		now = System.currentTimeMillis();
		end = now - time;
		System.out.println(end+"ms");
	}*/
}
